<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
// 		google weather api		
function getGoogleWeatherApi($zone = '10001'){
	$hl = 'zh-cn';
	$hl = 'en';
	$hl = 'zh-tw';
	$xml = simplexml_load_file("http://www.google.com/ig/api?hl=$hl&oe=utf-8&weather=$zone");
	$information = $xml->xpath("/xml_api_reply/weather/forecast_information");
	$current = $xml->xpath("/xml_api_reply/weather/current_conditions");
	$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
	return array($information, $current, $forecast_list);
}

function currency($price){
	$currency = ci()->settings_lib->item('currency');
	
	return $currency. $price;
}
function random($length, $numeric = 0) {
	mt_srand((double)microtime() * 1000000);
	if($numeric) {
		$hash = sprintf('%0'.$length.'d', mt_rand(0, pow(10, $length) - 1));
	} else {
		$hash = '';
		$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
		$max = strlen($chars) - 1;
		for($i = 0; $i < $length; $i++) {
			$hash .= $chars[mt_rand(0, $max)];
		}
	}
	return $hash;
}
